package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.service.EmpService;
import com.itheima.service.StudentService;
import com.itheima.vo.ClazzCountVo;
import com.itheima.vo.EmpJobVo;
import com.itheima.vo.EmpItemVo;
import com.itheima.vo.StudentItemVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private EmpService empService;
    @Autowired
    private StudentService studentService;
    @GetMapping("/empGenderData")
    public R getEmpGenderData() {
        log.info("统计员工性别信息");
        List<EmpItemVo> empGenderData = empService.getEmpGenderData();
        return R.ok(empGenderData);
    }

    @GetMapping("/empJobData")
    public R getEmpJobData() {
        log.info("统计各个职位的员工人数");
        EmpJobVo empJobData = empService.getEmpJobData();
        return R.ok(empJobData);
    }

    @GetMapping("/studentDegreeData")
    public R getStudentDegreeData() {
        log.info("统计学员的学历信息");
        List<StudentItemVo> dataList = studentService.getStudentDegreeData();
        return R.ok(dataList);
    }

    @GetMapping("/studentCountData")
    public R getStudentCountData() {
        log.info("统计每一个班级的人数");
        ClazzCountVo clazzCountVo = studentService.getStudentCountData();
        return R.ok(clazzCountVo);
    }
}
